<?php

namespace mpend\modules\home\models;

use Yii;
use common\helpers\Url;
use mpend\models\searchs\DemandCategorySearch;

/**
 * 首页默认面板信息
 *
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class DashboardLogic extends \common\logics\DashboardLogic {

    /**
     * @var array top pages
     */
    public $title = '临沂市河东区特派员';

    /**
     * @var array top pages
     */
    public $categories = [];

    /**
     * @var array The Function navigation menu
     */
    public $tabs = [];

    /**
     * Set top pages
     * @inheritdoc
     */
    protected function setCategories() {
        $model = new DemandCategorySearch();
        $model->pagesize = false;
        $model->limitSize = 7;
        $data = $model->search();
        $data[] = [
            'id' => 0,
            'title' => '全部分类',
            'icon' => Url::attach('/stcor/assets/category/00.png'),
            'cover' => '',
            'description' => '',
            'link' => Url::to(['/pages/category/main']),
        ];
        return $data;
    }

    /**
     * Set Dual column display panel
     * @inheritdoc
     */
    protected function setTabs() {
        return [
            [
                'title' => '为您推荐',
                'route' => Url::to('home/recommend'),
            ],
            [
                'title' => '最新需求',
                'route' => Url::to('home/recommend/newest'),
            ],
        ];
    }

}
